#include "cybertron/bridge/CybertronBridgeTaskBaseInterface.hpp"
#include "cybertron/core/Log.hpp"
#include <thread>

CYBERTRON_BEGIN

CybertronBridgeTaskBaseInterface::CybertronBridgeTaskBaseInterface() : mbInternalTask(false)
{
	mName = std::string(typeid(*this).name());
	mName = mName.substr(mName.find(":") + 2);
	mHz = 1;
	mTickMs = 1000;
	mFrame = 0;
	mSwitch = true;
	mTaskCompleteCounter = 0;
	mTaskType = proto::sensor::EBridgeTaskType_Unknown;
}

CybertronBridgeTaskBaseInterface::~CybertronBridgeTaskBaseInterface()
{
}

void CybertronBridgeTaskBaseInterface::InternalTask(bool bInternaltask)
{
	mbInternalTask = bInternaltask;
}

bool CybertronBridgeTaskBaseInterface::InternalTask()
{
	return mbInternalTask;
}

int16_t CybertronBridgeTaskBaseInterface::getTaskCompleteCounterAndReset()
{
	if (mbInternalTask)
		return -1;
	int16_t res = mTaskCompleteCounter;
	mTaskCompleteCounter = 0;
	return res;
}

void CybertronBridgeTaskBaseInterface::bridgeOnTimer(NodeHotAreaManager&)
{

}

void CybertronBridgeTaskBaseInterface::bridgeOnTimer(NodeHotAreaManager&, int ms, int msModNs)
{

}

bool CybertronBridgeTaskBaseInterface::bridgeMessageDirect(SocketBasePtr pSender, const Message & msg)
{
	return false;
}

CYBERTRON_END